package org.cll.lagou.study.ssm.service.impl;

import org.cll.lagou.study.ssm.dao.ResumeDao;
import org.cll.lagou.study.ssm.entity.Resume;
import org.cll.lagou.study.ssm.mapper.ResumeMapper;
import org.cll.lagou.study.ssm.service.ResumeService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 描述信息:
 *
 * @author CLL
 * @version 1.0
 * @date 2020/6/22 16:15
 */
@Service("defaultResumeService")
public class ResumeServiceImpl implements ResumeService {

    private static final Logger logger = LoggerFactory.getLogger(ResumeServiceImpl.class);

    private ResumeMapper resumeMapper;

    @Autowired
    public ResumeServiceImpl(ResumeMapper resumeMapper) {
        this.resumeMapper = resumeMapper;
    }

    @Override
    public Resume getById(Long id) {
        logger.info("====== 服务层");
        if (null == resumeMapper) {
            logger.info("====== 注入失败");
            return null;
        }
        return resumeMapper.getById(id);
    }

    @Override
    public List<Resume> selectAll() {
        return resumeMapper.selectAll();
    }

    @Override
    public int addResume(Resume resume) {
        return resumeMapper.addResume(resume);
    }

    @Override
    public int updateResume(Resume resume) {
        return resumeMapper.updateResume(resume);
    }

    @Override
    public int deleteById(Long id) {
        return resumeMapper.deleteById(id);
    }
}
